﻿Imports System
Imports System.Windows
Imports System.Windows.Controls

Partial Public Class InputComboWindow
    Inherits ChildWindow

    Private _SelectedItem As Object = Nothing
    Public ReadOnly Property SelectedItem As Object
        Get
            Return _SelectedItem
        End Get
    End Property

    Private _Llista As IEnumerable(Of Object)
    Private _DisplayProperty As String = ""

    Public Sub New()

        ' Llamada necesaria para el Diseñador de Windows Forms.
        InitializeComponent()

        ' Agregue cualquier inicialización después de la llamada a InitializeComponent().

    End Sub



    Public Sub New(ByVal message As String, pLLista As IEnumerable(Of Object), pDisplayProperty As String)
        InitializeComponent()
        Informacion.Text = message
        _Llista = pLLista
        _DisplayProperty = pDisplayProperty
    End Sub

    Private Sub InputWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Me.cboInput.ItemsSource = _Llista
        Me.cboInput.DisplayMemberPath = _DisplayProperty
    End Sub

    Private Sub OKButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles OkButton.Click
        _SelectedItem = cboInput.SelectedItem
        Me.DialogResult = True
    End Sub

    Private Sub CancelButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles CancelButton.Click
        Me.DialogResult = False
    End Sub

    Private Sub Child_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Closed
        Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, True)
    End Sub

End Class
